#include <iostream>
using namespace std;

bool is_seven(int x)
{
    if (!(x % 7))
        return true;
    while (x)
    {
        if (x % 10 == 7)
            return true;
        x /= 10;
    }
    return false;
}

int main()
{
    int n;
    cin >> n;
    int num = 1;
    // cout << is_seven(14) << endl;
    for (int i = 11; i <= n; ++i)
        if (is_seven(i))
            ++num;
    cout << num << endl;
    return 0;
}